package com.situ.orderingsystem.global;

import org.springframework.jdbc.datasource.SimpleDriverDataSource;

import javax.sql.DataSource;
import java.sql.Driver;

public class Global {
    private static DataSource ds;
    public  static  final String USER_LOGIN_KEY ="#user_login_key";
    public static void createDataSource(String driver,String url,String user,String pwd ){
        SimpleDriverDataSource sd = new SimpleDriverDataSource();
        try {
            sd.setDriverClass((Class<? extends Driver>)Class.forName(driver));
            sd.setUrl(url);
            sd.setUsername(user);
            sd.setPassword(pwd);
            ds = sd;
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }

    }
    public static DataSource getDataSource(){
        return ds;
    }
}
